﻿#include<iostream>
using namespace std;

struct role {
	char Name[0x20];
	int hp;
	int mp;
	int damage;
};

bool act(const role& acter, role* beacter);

int main() {

	role user{ "奥特曼",1000,1500,5001231 };
	role monster{ "小怪兽",1500,100,100 };

	role* pRole = &monster;

	cout << pRole << endl;//00000091D992F538
	cout << &pRole << endl;//00000091D992F588
	//cout << &monster << endl;//00000091D992F538

	if (act(user, pRole))cout << pRole->Name << endl;

}

bool act(const role& acter, role* beacter) {//role*&表示role类型指针的引用

	cout << beacter << endl;//00000091D992F538
	cout << &beacter << endl;//00000091D992F4C8

	beacter->hp -= acter.damage;
	bool bEend = beacter->hp < 0;

	beacter = (role*)&acter;
	return bEend;
}